package com.yx.changdao.common.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.yx.changdao.common.annotation.AutoFill;
import com.yx.changdao.common.utils.SysUtils;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;

/**
 * 角色表
 *
 * @author zhangqi
 * @date 2019-11-06 11:21:05
 */
@TableName(SysRole.TABLE_NAME)
public class SysRole implements Serializable {
    private static final long serialVersionUID = 1L;


    public static final String TABLE_NAME = "sys_role";

    /**
     * 角色ID
     */
    public static final String ROLE_ID = "role_id";
    /**
     * 角色名称
     */
    public static final String ROLE_NAME = "role_name";
    /**
     * 创建时间
     */
    public static final String CREATE_TIME = "create_time";
    /**
     * 创建人
     */
    public static final String CREATE_BY = "create_by";
    /**
     * 创建人
     */
    public static final String CREATE_BY_NAME = "create_by_name";
    /**
     * 更新时间
     */
    public static final String UPDATE_TIME = "update_time";
    /**
     * 更新人
     */
    public static final String UPDATE_BY = "update_by";


    /**
     * 角色ID
     */
    @NotEmpty(message = "角色id不能为空")
    @Length(min = 1, max = 32, message = "角色id只能在1~32位之间")
    @TableId(type = IdType.ASSIGN_ID)
    private String roleId;
    /**
     * 角色名称
     */
    @NotEmpty(message = "角色名称不能为空")
    @Length(min = 1, max = 32, message = "角色名称只能在1~32位之间")
    private String roleName;
    /**
     * 创建时间
     */
    @AutoFill
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    /**
     * 创建人
     */
    @AutoFill(klass = SysUtils.class, method = "currentUserId")
    @TableField(fill = FieldFill.INSERT)
    private String createBy;
    /**
     * 创建人
     */
    @AutoFill(klass = SysUtils.class, method = "currentUserName")
    @TableField(fill = FieldFill.INSERT)
    private String createByName;
    /**
     * 更新时间
     */
    @AutoFill
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
    /**
     * 更新人
     */
    @AutoFill(klass = SysUtils.class, method = "currentUserId")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateBy;

    /**
     * 菜单名集合
     */
    @TableField(exist = false)
    private String menuNames;


    public String getCreateByName() {
        return createByName;
    }

    public void setCreateByName(String createByName) {
        this.createByName = createByName;
    }

    public String getMenuNames() {
        return menuNames;
    }

    public void setMenuNames(String menuNames) {
        this.menuNames = menuNames;
    }

    public String getRoleId() {
        return roleId;
    }

    public void setRoleId(String roleId) {
        this.roleId = roleId;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }
}
